package cn.doitedu.dynamic_rule;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;

import java.io.File;
import java.io.IOException;

public class ReName {

    public static void main(String[] args) throws IOException {


        File file = new File("e:/abc");

        File[] files = file.listFiles();
        for (File d : files) {
            String name = d.getName();
            String[] split = name.split("-");

            File dd = new File(d.getAbsolutePath() + "/视频");

            File[] videos = dd.listFiles();
            for (File video : videos) {
                //FileUtils.moveFile(video,new File(dd.getAbsolutePath()+"\\"+split[2]+"."+video.getName()));

                System.out.println(video.getAbsolutePath()+" ==> " + StringUtils.replaceOnce(video.getAbsolutePath(),".","-"));
                FileUtils.moveFile(video,new File(StringUtils.replaceOnce(video.getAbsolutePath(),".","-")));


            }

            System.out.println("=================================================");

        }


    }

}
